/**
* Created by ren on 18/03/2017.
*/
<template>
  <el-table
    border
    v-if="tableData!==undefined"
    :data="tableData.records?tableData.records:tableData"
    @select="selectRow"
    @sort-change="tableSort"
    @cell-click="cellClick"
    style="width: 100%">
    <el-table-column
      type="selection"
      width="55">
    </el-table-column>
    <template v-for="(item,index) in tableHeader">
      <el-table-column :key="index" v-if="item.type!=='image'"
                       :prop="item.prop"
                       :label="item.label"
                       :width="item.width"
                       :formatter="item.formatter"
                       :type="item.type"
                       sortable
      >
      </el-table-column>
      <el-table-column :key="index" v-else
                       :prop="item.prop"
                       :label="item.label"
                       :width="item.width"
                       :formatter="item.formatter"
                       :type="item.type"
                       sortable
      >
        <template scope="scope">
          <img :src="scope.row.imagePath" style="width: 40px;height: 40px;padding-top: 7px;padding-left: 4px"/>
        </template>
      </el-table-column>
    </template>
    <el-table-column label="操作" v-if="tableHandle!==''">
      <template scope="scope">
        <el-button key='index' size="small" type="text" v-for="(item,index) in tableHandle"
                   @click="(index,row)=>item.event(scope.$index, scope.row)">{{item.text}}
        </el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
  export default {
    data () {
      return {
        selectObj: {}
      }
    },
    props: ['tableData', 'tableHeader', 'selectRow', 'tableSort', 'tableHandle', 'cellClick']
  }
</script>
